Skip to content

Distributed Tracing integration with SDK builds. #2741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

LarryOsterman
Copy link
Member

@LarryOsterman LarryOsterman commented Jun 30, 2025

Added distributed tracing policy and example service client integration.

PR Changes:

  1. Implemented RequestInstrumentationPolicy to add spans for HTTP operations.
  2. Implemented PublicApiInstrumentationPolicy to add spans for public APIs.
  3. Added public struct PublicApiInstrumentationInformation which expresses information used to create Public API spans.
  4. Integrated RequestInstrumentationPolicy and PublicApiInstrumentationPolicy to azure_core pipeline creation.
    1. Changed the azure_core::ClientOptions::deconstruct() method to deconstruct to a typespec_client_core::ClientOptions and a azure_core::CoreClientOptions (which is crate-private).
    2. Added http::Method::as_str() to return a string slice with the name of the HTTP method.
  5. Added span support for header propagation.
  6. PR feedback from previous PR (removed Span::add_event, removed AttributeValue::U64 and replaced it with AttributeValue::F64),

Bug fix: Propagate retry policy options from client options to retry policy.

@github-actions github-actions bot added the Azure.Core The azure_core crate label Jun 30, 2025
@LarryOsterman LarryOsterman force-pushed the larryo/opentelemetry_prototype_implementation branch from 32c2ac1 to baccb1b Compare June 30, 2025 22:38
Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some cosmetic comments, look great in general!

@LarryOsterman LarryOsterman linked an issue Jul 8, 2025 that may be closed by this pull request
@LarryOsterman
Copy link
Member Author

@heaths @lmolkova @analogrelay @RickWinter At this point, I think I'm done with this PR, let me know what you think about it.

Copy link
Member

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working my way through most of azure_core_opentelemetry but wrapping up my day and wanted to get some of the comments out there. Almost entirely style/idiom stuff, with a few other thoughts on the proc macro and attribute key storage. Looking good! I like the proc macros!

@RickWinter RickWinter requested a review from Copilot July 22, 2025 17:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements distributed tracing integration with the Azure SDK for Rust builds, adding comprehensive telemetry support for HTTP operations and public APIs. The implementation includes two main instrumentation policies and integrates them into the core pipeline creation process.

Key Changes:

  • Implemented RequestInstrumentationPolicy to add spans for HTTP operations with W3C trace context propagation
  • Implemented PublicApiInstrumentationPolicy to add spans for public API calls
  • Added comprehensive tracing attribute support with OpenTelemetry compatibility
  • Integrated instrumentation policies into the azure_core pipeline with client options configuration

Reviewed Changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/typespec/typespec_client_core/src/tracing/ Core tracing trait definitions with updated APIs for span creation and attribute handling
sdk/core/azure_core_opentelemetry/ OpenTelemetry integration implementation with tracer provider and span management
sdk/core/azure_core_macros/ Procedural macros for automatic instrumentation of client structs and methods
sdk/core/azure_core/src/http/policies/instrumentation/ HTTP request instrumentation policy with telemetry attributes
sdk/typespec/typespec_client_core/src/http/ Pipeline and retry policy updates for instrumentation support

@LarryOsterman LarryOsterman enabled auto-merge (squash) July 22, 2025 20:45
@LarryOsterman LarryOsterman merged commit 737a9a1 into Azure:main Jul 22, 2025
17 checks passed
@LarryOsterman LarryOsterman deleted the larryo/opentelemetry_prototype_implementation branch July 22, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core The azure_core crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement proc macros to simplify the authoring experience for Distributed Tracing Implement Distributed Tracing conventions for Azure SDK clients.
5 participants